package com.zhihuichongcheng.application.util;

import android.content.Context;
import android.content.Intent;

import com.zhihuichongcheng.application.ui.task.SubTaskListActivity;
import com.zhihuichongcheng.application.ui.task.TaskListActivity;

/**
 * BroadCast Utils Created by LK on 2017/1/16.
 */
public class BroadCastUtils {
    private static BroadCastUtils broadCastUtils;

    private BroadCastUtils() {
    }

    public static synchronized BroadCastUtils getInstance() {
        if (null == broadCastUtils)
            broadCastUtils = new BroadCastUtils();

        return broadCastUtils;
    }


    public void actionRefreshTaskList(Context context) {
        Intent intent = new Intent();
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        intent.setAction(TaskListActivity.ACTION_REFRESH_LIST);
        context.sendBroadcast(intent);
    }

    public void actionRefreshSubTaskList(Context context) {
        Intent intent = new Intent();
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        intent.setAction(SubTaskListActivity.ACTION_REFRESH_SUB_LIST);
        context.sendBroadcast(intent);
    }
}
